const { defineConfig } = require("@vue/cli-service");
const CompressionWebpackPlugin = require("compression-webpack-plugin");
const productionGzipExtensions = ["js", "css"];
module.exports = defineConfig({
	transpileDependencies: true,
	productionSourceMap: false,
	configureWebpack: (config) => {
		if (process.env.NODE_ENV === "production") {
			return {
				plugins: [
					new CompressionWebpackPlugin({
						filename: "[path][base].gz",
						algorithm: "gzip",
						test: new RegExp(
							"\\.(" + productionGzipExtensions.join("|") + ")$"
						),
						threshold: 10240,
						minRatio: 0.8,
					}),
				],
			};
		}
	},
});
